export async function UploadFiles() {
    const ftp = require("basic-ftp");
    const fs = require("fs");
    const path = require("path");
    const json5 = require("json5");
    const ftpConfig = json5.parse(
        fs.readFileSync("./ftp.config", { encoding: "utf-8" })
    );
    const client = new ftp.Client();
    client.ftp.verbose = true;
    try {
        await client.access(ftpConfig.uploadconfig.ftpConnectConfig);
        await client.ensureDir(ftpConfig.uploadconfig.remotePath);
        await client.clearWorkingDir();
        await client.uploadFromDir(ftpConfig.uploadconfig.uploadPath);
    }
    catch(err) {
        console.log(err);
        return false;
    }
    finally {
        client.close();
    }

    return true;
}
